package com.atguigu.containers;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * ClassName: ArrayListTest
 * Package: com.atguigu.communcation.containers
 * Description:
 *
 * @author: fu-wang
 * @create: 2024/10/29 19:17
 * version: 1.0
 */
public class ArrayListTest {

    public static void main(String[] args) {

//        List<String> list = Collections.synchronizedList(new ArrayList<>());
        List<String> list = new CopyOnWriteArrayList<>();
        for (int i = 0; i < 100; i++) {
            new Thread(()->{
                list.add(UUID.randomUUID().toString());
                System.out.println(list);
            },"thread name").start();
        }
    }
}
